package com.next.core.util;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class StatMap<T> {
	private Map<T, Integer> innerMap;
	
	public StatMap()
	{
		innerMap = new HashMap<T, Integer>();
	}
	
	public void incr(T t)
	{
		if (innerMap.containsKey(t))
			innerMap.put(t, innerMap.get(t) + 1);
		else
			innerMap.put(t, 1);
	}
	
	public int get(T t) {
		if (innerMap.containsKey(t))
			return innerMap.get(t);
		
		return 0;
	}
	
	public Set<T> keySet(){
		return innerMap.keySet();
	}

	public void desc(T t) {
		if (innerMap.containsKey(t))
			innerMap.put(t, innerMap.get(t) - 1);
		else
			innerMap.put(t, 1);	
	}

	public void setZore(T t) {
		innerMap.put(t, 0);
	}

	public void set(T t, int c) {
		innerMap.put(t, 0);
	}
}
